<?php
    Class Paradox {
    public $flag;
    public $filename;
    
    public $noncea;
    public $nonceb;
    
    /*
    *  First paradox
    *
    *  Same content but diffrent hashes
    */
    function paradox_one() {
        if ($this->noncea != $this->nonceb && md5($this->noncea) == md5($this->nonceb)) {
            return true;
        } else {
            echo "Failed in paradox_one";
            return false;
        }
    }
    
    /*
    *  Second paradox
    *
    *  Find a file not exist in this host
    */
    function paradox_two() {
        if (file_get_contents($this->filename) == 'welcome_to_c1ctf') {
            return true;
        } else {
            echo "Failed in paradox_two";
            return false;
        }
    }
    
    /*
    *  Last paradox
    *
    *  Get the flag before you get it
    */
    function paradox_three() {
        global $flag;
        if ($this->flag == $flag) {
            return true;
        } else {
            echo "Failed in paradox_three";
            return false;
        }
    }
    
    function __destruct() {
        global $flag;
        if ($this->paradox_one() && $this->paradox_two() && $this->paradox_three()) {
            echo "You solved all paradox! Here is your flag<br>";
            echo $flag;
        }
    }
}
$usr = new Paradox;
echo serialize($usr);
?>

